#include <stdio.h>

int main()
{
    int price[4]={50,30,80,40};
    int total=0,id;
    while(1) {
        scanf("%d",&id);
        if(id<=0||id>sizeof(price)/sizeof(price[0])) {
            break;
        }
        total += price[id-1];
    }
    printf("%d\n",total);
    return 0;
}